-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement gaussian splatting ply file saving with o3d #427
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its better if we can load existing checkpoint, then save it to PLY:
if cfg.ckpt is not None:
# run eval only
ckpts = [
torch.load(file, map_location=runner.device, weights_only=True)
for file in cfg.ckpt
]
for k in runner.splats.keys():
runner.splats[k].data = torch.cat([ckpt["splats"][k] for ckpt in ckpts])
step = ckpts[0]["step"]
runner.eval(step=step)
runner.render_traj(step=step)
save_ply(runner.splats, f"{cfg.result_dir}/point_cloud_{step}.ply")
examples/simple_trainer.py
Outdated
@@ -723,6 +765,7 @@ def train(self): | |||
torch.save( | |||
data, f"{self.ckpt_dir}/ckpt_{step}_rank{self.world_rank}.pt" | |||
) | |||
save_ply(self.splats, f"{self.ply_dir}/point_cloud.ply") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request:
save_ply(self.splats, f"{self.ply_dir}/point_cloud_{step}.ply")
Interesting. The arm chairs are equally colored? 🙂 |
seems the result is more washed out in open3D. The most noticeable is black chair (third image). |
Here is it, the code comes from The command is easy
Then it will create splats. |
Should be fixed @ichsan2895. |
Well, creating PLY from checkpoints is just adding a single line of code.
|
It is not about adding a line of code. There is some reasoning behind why it writes the checkpoint in the way it does and I am not aware of it. The ply file should be directly saved during training and not evaluation. There could be a script added that converts old checkpoints to ply files if desired. Beside saving the trained scene in an alternative format, the ckpts are pretty useless. They don't serialize the full training state (optimzer, scheduler) so it is not possible to resume the training properly. In fact, the ply file contains the same information. Additional input from the maintainers is needed. |
Would this method work when appearance optimization is enabled? Since the sh0 and shN are not available. |
@bolopenguin Good catch. I bake the appearance into the shs so it can be opened by any viewer. @liruilong940607 What does this pr require to go into gsplat? |
Not arguing for it to block this PR, but as an FYI this will break things for folks running Python 3.12, which the latest open3d release doesn't support. (afaik this is the main thing that's preventing Python 3.12 support in the main nerfstudio repo) It looks like the open3d folks merged their Python 3.12 PR a few days ago though, so maybe this will resolved soon? isl-org/Open3D#6717 |
Ah, interesting! We could either wait until open3D is compatible with Python 3.12 or we write the ply file directly similarly as it is done in Nerfstudio. Any preferences? |
I removed open3D in commit 36e3df3 in case that's blocking. |
Is there some difference in implementation from the 3DGS official version? I tried to save the training result as a ply file and then view it in the web viewer SuperSplat. I observed some color artifact, but it is fine in the gsplat viewer. |
I am not sure what supersplat is doing behind the curtains. I can compare the output of the last two commits. They should be identical and were tested. |
Encountered a strange issue. Everything working when training on previous datasets. However, when training on a new dataset and when save it as a ply file, an error is displayed.
Training cli:
But the viewer working fine with:
The problem only happen at ply. Files of ply generated, but open with Postshot show “PlyReader: unexpected table size”. MeshLab: "Error encountered while loading file. Unexpected EOF". |
@MrNeRF Yes, pull the commit and the error don't show again. Thanks for the updating. |
Wow, one month later of inactive PR of gs-scaffold. But I am curious how to export Gs-scaffold to PLY? Is it compatible with supersplat or mkkellogg gaussian-viewer? |
No, it is not that straight forward. It would be best to support it directly. I think currently is busy season in terms of getting the publications camera ready... likely there is not much time left for open source projects. |
Ply saving based on open3D. That's a quick way to generate ply files.
I think this is a highly requested feature. Should work with default and mcmc densification strategies.